package com.hghivln.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hghivln.blog.entity.Link;
import com.hghivln.blog.mapper.LinkMapper;
import com.hghivln.blog.service.LinkService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 友情链接表 服务实现类
 * </p>
 *
 * @author hghivln
 * @since 2021-09-06
 */
@Service
public class LinkServiceImpl extends ServiceImpl<LinkMapper, Link> implements LinkService {

    @Override
    public void deleteById(Long id) {
        getBaseMapper().delById(id);
    }

    @Override
    public List<Link> getAllList() {
        QueryWrapper<Link> qw = new QueryWrapper<>();
        qw.eq("deleted",0);
        qw.select("link_id","link_name","link_url","created_time","update_time");
        return getBaseMapper().selectList(qw);
    }
}
